package com.company;

/**
 * @author 刘宇韬
 */

import java.util.Scanner;

public class ATM取款机 {
    public static void main(String[] args) {
        /*****start*****/
        System.out.println("欢迎使用中国人民银行ATM取款机");
        Scanner input = new Scanner(System.in);
        int a = 1000, c = a, m = 2;
        while (m != 1) {
            System.out.println("请输入取款金额：");
            int b = input.nextInt();
            if (b <= c) {
                c -= b;
                System.out.println("剩余金额：" + c + "，是否继续(’1’：结束，’2’：继续)：");
                int j = input.nextInt();
                m = j;
                switch (m) {
                    case 1:
                        System.out.println("取款结束！");
                        break;
                    case 2:
                        m = 2;
                        break;
                }
            } else {
                System.out.println("目前余额：" + c + "无法满足您的取款需求！");
            }
        }

        /*****end*****/
    }
}

